package ua.com.softway.db.export;

public class FieldExportConstraint {

    private final String field;
    private final Object value;

    public FieldExportConstraint(String field, Object value) {
        this.field = field;
        this.value = value;
    }

    public String whereClause() {
        String s;
        
        if (value instanceof Number)
            s = "" + value;
        else if (value instanceof String)
            s = "'" + value + "'";
        else
            throw new IllegalArgumentException("Invalid argument for the field constraint");
        
        return field + " = " + s;
    }

}
